﻿using AutoMapper;
using J.Model;
using J.ProductSet.Application.Command.ReservationinformationtableCommand;
using MediatR;
using SqlSugar;

namespace J.ProductSet.Application.CommandHandler.ReservationinformationtableCommandHandler
{
    public class RESERVATIONINFORMATIONTABLEUpdateCommandHandler : IRequestHandler<RESERVATIONINFORMATIONTABLEUpdateCommand, int>
    {
        private readonly ISqlSugarClient _sqlSugarClient;
        public IMapper _mapper;
        public RESERVATIONINFORMATIONTABLEUpdateCommandHandler(ISqlSugarClient sqlSugarClient, IMapper mapper)
        {
            _sqlSugarClient = sqlSugarClient;
            _mapper = mapper;
        }
        public Task<int> Handle(RESERVATIONINFORMATIONTABLEUpdateCommand request, CancellationToken cancellationToken)
        {
            RESERVATIONINFORMATIONTABLE models = _mapper.Map<RESERVATIONINFORMATIONTABLE>(request);
            return _sqlSugarClient.Updateable(models).ExecuteCommandAsync();
        }
    }
}
